package com.taobao.txc.a.b;

import com.taobao.txc.common.LoggerInit;
import com.taobao.txc.common.LoggerWrap;
import com.taobao.txc.common.c.A;
import com.taobao.txc.common.c.C;
import com.taobao.txc.common.c.D;
import com.taobao.txc.common.c.E;
import com.taobao.txc.common.c.F;
import com.taobao.txc.common.c.b;
import com.taobao.txc.common.c.g;
import com.taobao.txc.common.c.h;
import com.taobao.txc.common.c.i;
import com.taobao.txc.common.c.j;
import com.taobao.txc.common.c.k;
import com.taobao.txc.common.c.l;
import com.taobao.txc.common.c.m;
import com.taobao.txc.common.c.n;
import com.taobao.txc.common.c.o;
import com.taobao.txc.common.c.r;
import com.taobao.txc.common.c.s;
import com.taobao.txc.common.c.t;
import com.taobao.txc.common.c.w;
import com.taobao.txc.common.c.x;
import com.taobao.txc.common.c.y;
import com.taobao.txc.common.c.z;
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageCodec;
import java.nio.ByteBuffer;
import java.util.List;
import java.util.Map;

public class v
  extends ByteToMessageCodec<u>
{
  private static short a = -9510;
  private static int b = 14;
  private static final LoggerWrap c = LoggerInit.logger;
  
  protected void a(ChannelHandlerContext paramChannelHandlerContext, u paramu, ByteBuf paramByteBuf)
  {
    C localC = null;
    ByteBuffer localByteBuffer = ByteBuffer.allocate(128);
    if ((paramu.f() instanceof C)) {
      localC = (C)paramu.f();
    }
    localByteBuffer.putShort(a);
    int i = (paramu.b() ? 64 : 0) | (paramu.d() ? 32 : 0) | (paramu.c() ? 128 : 0) | (localC != null ? 16 : 0);
    localByteBuffer.putShort((short)i);
    byte[] arrayOfByte1;
    if ((paramu.f() instanceof a))
    {
      localByteBuffer.putShort((short)0);
      localByteBuffer.putLong(paramu.e());
      localByteBuffer.flip();
      arrayOfByte1 = new byte[localByteBuffer.limit()];
      localByteBuffer.get(arrayOfByte1);
      paramByteBuf.writeBytes(arrayOfByte1);
      return;
    }
    try
    {
      if (localC != null)
      {
        localC = (C)paramu.f();
        localC.a(paramChannelHandlerContext);
        localByteBuffer.putShort(localC.b_());
        localByteBuffer.putLong(paramu.e());
        localByteBuffer.flip();
        arrayOfByte1 = new byte[localByteBuffer.limit()];
        localByteBuffer.get(arrayOfByte1);
        paramByteBuf.writeBytes(arrayOfByte1);
        paramByteBuf.writeBytes(localC.c());
      }
      else
      {
        c.info("msg:" + paramu.f().toString());
        arrayOfByte1 = a(paramu.f());
        localByteBuffer.putShort((short)arrayOfByte1.length);
        localByteBuffer.putLong(paramu.e());
        localByteBuffer.put(arrayOfByte1);
        localByteBuffer.flip();
        byte[] arrayOfByte2 = new byte[localByteBuffer.limit()];
        localByteBuffer.get(arrayOfByte2);
        paramByteBuf.writeBytes(arrayOfByte2);
      }
    }
    catch (Exception localException)
    {
      c.a("encode error", "", localException);
      throw localException;
    }
    if (c.c()) {
      c.debug("Send:" + paramu.f());
    }
  }
  
  protected void decode(ChannelHandlerContext paramChannelHandlerContext, ByteBuf paramByteBuf, List<Object> paramList)
  {
    if (c.c()) {
      c.debug("channeL:" + paramChannelHandlerContext.channel());
    }
    int i = paramByteBuf.readableBytes();
    if (i < b) {
      return;
    }
    int j = paramByteBuf.readerIndex();
    byte[] arrayOfByte = new byte[b];
    paramByteBuf.readBytes(arrayOfByte);
    ByteBuffer localByteBuffer = ByteBuffer.wrap(arrayOfByte);
    int k = localByteBuffer.getShort();
    if (k != a)
    {
      paramChannelHandlerContext.channel().close();
      return;
    }
    int m = localByteBuffer.getShort();
    boolean bool1 = (0x20 & m) > 0;
    boolean bool2 = (0x80 & m) > 0;
    int n = (0x10 & m) > 0 ? 1 : 0;
    int i1 = 0;
    short s = 0;
    if (n == 0) {
      i1 = localByteBuffer.getShort();
    } else {
      s = localByteBuffer.getShort();
    }
    long l = localByteBuffer.getLong();
    if (bool1)
    {
      localu = new u();
      localu.a(l);
      localu.a(true);
      localu.c(bool1);
      localu.b(bool2);
      if (bool2) {
        localu.a(a.a);
      } else {
        localu.a(a.b);
      }
      paramList.add(localu);
      return;
    }
    if ((i1 > 0) && (paramByteBuf.readableBytes() < i1))
    {
      paramByteBuf.readerIndex(j);
      return;
    }
    u localu = new u();
    localu.a(l);
    localu.a((0x40 & m) > 0);
    localu.c(false);
    localu.b(bool2);
    try
    {
      Object localObject1;
      if (n != 0)
      {
        localObject1 = a(s);
        ((C)localObject1).a(paramChannelHandlerContext);
        if (!((C)localObject1).a(paramByteBuf))
        {
          paramByteBuf.readerIndex(j);
          return;
        }
        localu.a(localObject1);
      }
      else
      {
        localObject1 = new byte[i1];
        paramByteBuf.readBytes((byte[])localObject1);
        Object localObject2 = a((byte[])localObject1);
        localu.a(localObject2);
      }
    }
    catch (Exception localException)
    {
      c.a("decode error", "", localException);
      throw localException;
    }
    paramList.add(localu);
    if (c.c()) {
      c.debug("Receive:" + localu.f() + ",messageId:" + l);
    }
  }
  
  public C a(short paramShort)
  {
    Object localObject;
    switch (paramShort)
    {
    case 1: 
      localObject = new b();
      break;
    case 2: 
      localObject = new com.taobao.txc.common.c.c();
      break;
    case 3: 
      localObject = new com.taobao.txc.common.c.f();
      break;
    case 4: 
      localObject = new g();
      break;
    case 5: 
      localObject = new h();
      break;
    case 6: 
      localObject = new i();
      break;
    case 7: 
      localObject = new l();
      break;
    case 8: 
      localObject = new m();
      break;
    case 9: 
      localObject = new n();
      break;
    case 10: 
      localObject = new o();
      break;
    case 11: 
      localObject = new com.taobao.txc.common.c.v();
      break;
    case 12: 
      localObject = new w();
      break;
    case 13: 
      localObject = new x();
      break;
    case 14: 
      localObject = new y();
      break;
    case 15: 
      localObject = new com.taobao.txc.common.c.d();
      break;
    case 16: 
      localObject = new com.taobao.txc.common.c.e();
      break;
    case 17: 
      localObject = new z();
      break;
    case 18: 
      localObject = new A();
      break;
    case 19: 
      localObject = new D();
      break;
    case 20: 
      localObject = new E();
      break;
    case 21: 
      localObject = new r();
      break;
    case 22: 
      localObject = new s();
      break;
    case 101: 
      localObject = new c();
      break;
    case 102: 
      localObject = new d();
      break;
    case 103: 
      localObject = new e();
      break;
    case 104: 
      localObject = new f();
      break;
    case 113: 
      localObject = new j();
      break;
    case 114: 
      localObject = new k();
      break;
    case 121: 
      localObject = new t();
      break;
    case 122: 
      localObject = new com.taobao.txc.common.c.u();
      break;
    case 23: 
    case 24: 
    case 25: 
    case 26: 
    case 27: 
    case 28: 
    case 29: 
    case 30: 
    case 31: 
    case 32: 
    case 33: 
    case 34: 
    case 35: 
    case 36: 
    case 37: 
    case 38: 
    case 39: 
    case 40: 
    case 41: 
    case 42: 
    case 43: 
    case 44: 
    case 45: 
    case 46: 
    case 47: 
    case 48: 
    case 49: 
    case 50: 
    case 51: 
    case 52: 
    case 53: 
    case 54: 
    case 55: 
    case 56: 
    case 57: 
    case 58: 
    case 59: 
    case 60: 
    case 61: 
    case 62: 
    case 63: 
    case 64: 
    case 65: 
    case 66: 
    case 67: 
    case 68: 
    case 69: 
    case 70: 
    case 71: 
    case 72: 
    case 73: 
    case 74: 
    case 75: 
    case 76: 
    case 77: 
    case 78: 
    case 79: 
    case 80: 
    case 81: 
    case 82: 
    case 83: 
    case 84: 
    case 85: 
    case 86: 
    case 87: 
    case 88: 
    case 89: 
    case 90: 
    case 91: 
    case 92: 
    case 93: 
    case 94: 
    case 95: 
    case 96: 
    case 97: 
    case 98: 
    case 99: 
    case 100: 
    case 105: 
    case 106: 
    case 107: 
    case 108: 
    case 109: 
    case 110: 
    case 111: 
    case 112: 
    case 115: 
    case 116: 
    case 117: 
    case 118: 
    case 119: 
    case 120: 
    default: 
      String str = (String)F.l.get(Short.valueOf(paramShort));
      throw new com.taobao.txc.common.b.c("unknown class:" + str + " in txc message codec.");
    }
    return localObject;
  }
  
  public static byte[] a(Object paramObject)
  {
    if (paramObject == null) {
      throw new NullPointerException();
    }
    throw new com.taobao.txc.common.b.c("hessianSerialize error");
  }
  
  public static Object a(byte[] paramArrayOfByte)
  {
    if (paramArrayOfByte == null) {
      throw new NullPointerException();
    }
    throw new com.taobao.txc.common.b.c("hessianDeserialize error");
  }
}


/* Location:           C:\Users\ibm\Downloads\txc-yun-sample (1)\txc-yun-sample\lib\txc-client-2.0.72.jar
 * Qualified Name:     com.taobao.txc.a.b.v
 * JD-Core Version:    0.7.0.1
 */